<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">
<meta charset="utf-8">
<head th:include="include :: header"></head>
<body class="gray-bg">
<div class="wrapper wrapper-content ">
    <div class="row">
        <div class="col-sm-12">
            <div class="ibox float-e-margins">
                <div class="ibox-content">
                    <form class="form-horizontal m-t" id="signupForm">
                        <input id="product_id" name="productId" th:value="${product.productId}" type="hidden">
                        <div class="form-group">
                            <label class="col-sm-3 control-label">分类：</label>
                            <div class="col-sm-3">
                                <input type="hidden" id="categoryId" name="categoryId" th:value="${product.categoryId}"
                                       class="form-control">
                                <div class="dropdown">
                                    <button class="btn btn-info dropdown-toggle" type="button" id="dropdownMenu1"
                                            data-toggle="dropdown" aria-haspopup="true" aria-expanded="true"
                                            th:text="${product.categoryDO.categoryName}">

                                        <span class=" caret"></span>
                                    </button>
                                    <ul class="dropdown-menu bg-info" style="background-color: #e5ffff;">
                                        <li th:each="category : ${categorys}"><a href="#"  th:onclick="'javascript:catclick(\''+${category.categoryId}+'\', \''+${category.categoryName}+'\');'" th:class="${category.categoryId}">[[${category.categoryName}]]</a>
                                        </li>


                                    </ul>
                                </div>
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-sm-3 control-label">产品编号：</label>
                            <div class="col-sm-8">
                                <input id="productNum" name="productNum" th:value="${product.productNum}"
                                       class="form-control" type="text">
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-sm-3 control-label">设备名称：</label>
                            <div class="col-sm-8">
                                <input id="shebeiName" name="shebeiName" th:value="${product.shebeiName}"
                                       class="form-control" type="text">
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-sm-3 control-label">基本参数：</label>
                            <div class="col-sm-8">
                                <input id="baseParam" name="baseParam" th:value="${product.baseParam}"
                                       class="form-control" type="text">
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-sm-3 control-label">完整参数：</label>
                            <div class="col-sm-8">
                                <input id="allParam" name="allParam" th:value="${product.allParam}" class="form-control"
                                       type="text">
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-sm-3 control-label">单位：</label>
                            <div class="col-sm-8">
                                <input id="unit" name="unit" th:value="${product.unit}" class="form-control"
                                       type="text">
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-sm-3 control-label">面价：</label>
                            <div class="col-sm-8">
                                <input id="facePrice" name="facePrice" th:value="${product.facePrice}"
                                       class="form-control" type="text">
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-sm-3 control-label">材料成本：</label>
                            <div class="col-sm-8">
                                <input id="chengben" name="chengben" th:value="${product.chengben}" class="form-control"
                                       type="text">
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-sm-3 control-label">机器成本：</label>
                            <div class="col-sm-8">
                                <input id="shebeiChengben" name="shebeiChengben" th:value="${product.shebeiChengben}"
                                       class="form-control" type="text">
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-sm-3 control-label">人工成本：</label>
                            <div class="col-sm-8">
                                <input id="anzhuangChengben" name="anzhuangChengben"
                                       th:value="${product.anzhuangChengben}" class="form-control" type="text">
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-sm-3 control-label">二级类别：</label>
                            <div class="col-sm-8">
                                <input id="level2Cate" name="level2Cate" th:value="${product.level2Cate}"
                                       class="form-control" type="text">
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-sm-3 control-label">品牌：</label>
                            <div class="col-sm-8">
                                <input id="brand" name="brand" th:value="${product.brand}" class="form-control"
                                       type="text">
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-sm-3 control-label">型号：</label>
                            <div class="col-sm-8">
                                <input id="xinghao" name="xinghao" th:value="${product.xinghao}" class="form-control"
                                       type="text">
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-sm-3 control-label">备注：</label>
                            <div class="col-sm-8">
                                <input id="beizhu" name="beizhu" th:value="${product.beizhu}" class="form-control"
                                       type="text">
                            </div>
                        </div>

                        <div class="form-group">
                            <div class="col-sm-8 col-sm-offset-3">
                                <button type="submit" class="btn btn-primary">提交</button>
                            </div>
                        </div>
                    </form>
                </div>
            </div>
        </div>
    </div>
</div>
<div th:include="include::footer"></div>
<script type="text/javascript">

    $(function () {
        var faceprice = $("#facePrice").val();
        $("#facePrice").val(formatnum(faceprice));

        var chengben = $("#chengben").val();
        $("#chengben").val(formatnum(chengben));

        var shebeiChengben = $("#shebeiChengben").val();
        $("#shebeiChengben").val(formatnum(shebeiChengben));

        var anzhuangChengben = $("#anzhuangChengben").val();
        $("#anzhuangChengben").val(formatnum(anzhuangChengben));

    })



    function formatnum(num) {

        return new Number(num);
    }




    function catclick(catId, catName) {
        $("#dropdownMenu1").text(catName);
        $("#categoryId").val(catId);

    }
</script>
<script type="text/javascript" src="/js/appjs/system/product/edit.js">
</script>
</body>
</html>
